import request from '@/utils/request'
import downloadService from "@/utils/downloadService";

export function listGoods(pageNum, pageSize, autherId, name, state) {
    return request({
        url: `/goods/list?pageNum=${pageNum}&pageSize=${pageSize}&autherId=${autherId}&name=${name}&state=${state}`,
        method: 'get'
    })
}

export function addGood(good) {
    return request({
        url: `/goods`,
        method: 'post',
        data: good
    })
}

export function updateGood(good) {
    return request({
        url: `/goods`,
        method: 'put',
        data: good
    })
}

export function delGood(id) {
    return request({
        url: `/goods/${id}`,
        method: 'delete',
    })
}

export function exportFile() {
    return downloadService({
        url: `/goods/export`,
        method: 'get',
    })
}

export function outGood(id) {
    return request({
        url: `/goods/out/${id}`,
        method: 'put',
    })
}